home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
dev
/
basic
/
Mildred.lha
/
lha
/
FDsExample2.lha
/
FDsMildredExample2.asc
next >
Wrap
Text File
|
1999-01-05
|
3KB
|
97 lines
;Correct CludgeShape Mildred Library Example.
;
;Programmed by : Mikkel Loekke, aka. FlameDuck.
;
;Please read the README file.
;
WBStartup
NoCli
DEFTYPE.l
MCPU Processor ; Tell Mildred which CPU it should use.
Mc2pCPUmode Processor ; Tell Mildred which CPU it should use for c2p.
MReserveBitmaps 1 ; Tell Mildred that we're going to use 1 chunky bitmap.
MReservec2pWindows 1 ; Tell it we only need one c2p display.
MReserveShapes 1 ; Tell Mildred that we need a shape aswell.
.initgraphics
MBitmap 0,320,256 ; This will contain our chunky buffer.
Fil$="RAM:TempBall" ; Or wherever you have the chunky object lying arround.
*fetchady.l=AllocMem (FileSize(Fil$+".CNK")+16,$10000) ; Reserve enough memory to contain our entire ball object,
; and a 16 byte safety buffer. (Just in case.)
If *fetchady ; if we succeed
*loadady.l=(*fetchady+16) AND $FFFFFFF0 ; Calculate the 16 byte offset we need.
If BLoad(Fil$+".CNK",*loadady) ; And load our shape at THAT address.
MCludgeShape 0,32,32,*fetchady ; Now use the untruncated address to fetch the image.
MMakeCookie 0
Else
EZRequest "File not found: "+Fil$ ; Nice error message
End
EndIf
Else
EZRequest "Couldn't allocate enough memory !" ; Another nice error message.
End
EndIf
Dim bx.w(63),by.w(63),bxa.b(63),bya.b(63)
For x.b=0 To 7
For y.b=0 To 7
bx(x+8*y)=32+32*x
by(x+8*y)=24+24*y
Next
Next
Mc2pWindow 0,320,256 ; Setup structures for c2p conversions.
*pbb.l=AllocMem(320*256,$10002) ; Get some free CHIP memory.
CludgeBitMap 0,320,256,8,*pbb ; And make it a planar bitmap.
Dim scrtaglst.TagItem(7) ; All this stuff sets up our
scrtaglst(0)\ti_Tag = #SA_Left ; Taglist for the screen we
scrtaglst(0)\ti_Data = 0 ; want.
scrtaglst(1)\ti_Tag = #SA_Depth
scrtaglst(1)\ti_Data = 8
scrtaglst(2)\ti_Tag = #SA_Width
scrtaglst(2)\ti_Data = 320
scrtaglst(3)\ti_Tag = #SA_Height
scrtaglst(3)\ti_Data = 256
scrtaglst(4)\ti_Tag = #SA_BitMap
scrtaglst(4)\ti_Data = Addr BitMap (0)
scrtaglst(5)\ti_Tag = #SA_ShowTitle
scrtaglst(5)\ti_Data = 0
scrtaglst(6)\ti_Tag = #SA_Draggable
scrtaglst(6)\ti_Data = 0
scrtaglst(7)\ti_Tag = #TAG_END ; The most important tag of them all.
LoadPalette 0,Fil$+".PAL" ; Load our palette info.
ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
ShowPalette 0 ; Attach our palette to the screen.
Repeat ; Repeat our mainloop ....
Mc2p *pbb ; Convert our chunky buffer to
; our planar bitmap.
MCls ; Clear our chunky buffer
For t = 0 To 63
MBlit 0,bx(t),by(t)
bx(t)+bxa(t)
by(t)+bya(t)
If bx(t) = 0 OR bx(t)=287 Then bxa(t)*-1
If by(t) = 0 OR by(t)=223 Then bya(t)*-1
Next
Until RawStatus($45) ; .... Until we press Escape.
End ; End our nice program.